import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity('roles')
export class Role {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 100, comment: '角色名称' })
  name: string;

  @Column({ type: 'text', nullable: true, comment: '脚本URL' })
  script_url: string;

  @Column({ type: 'jsonb', nullable: true, comment: '项目规则' })
  rules: Record<string, any>;

  @Column({ length: 500, nullable: true, comment: '描述' })
  description: string;

  @CreateDateColumn({ comment: '创建时间' })
  created_at: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  updated_at: Date;
}
